let Person=require("./person");
let Student=require("./student");
let Class=require("./class");
module.exports=class Teacher extends Person{
    constructor(id,name,age,klasses){
        super(id,name,age);
        this.klasses=klasses;
    }
    introduce(){
        if(!this.klasses){
            return super.introduce()+" I am a Teacher. I teach No Class.";
        }
        else {
            let result=this.klasses[0].number;
            for(let i=1;i<this.klasses.length;i++){
                result+=", ";
                result+=this.klasses[i].number;
            }
            return super.introduce()+" I am a Teacher. I teach Class "+result+".";
        }
    }
    isTeaching(student){
        if((student.klass.number==this.klasses[0].number)||(student.klass.number==this.klasses[1].number))
        return true;
        else 
        return false;
    }
}



